Skip to content

GH-44101: [C++][Parquet] Tools: Debug Print for Json should be valid JSON - #44532

Merged
mapleFU merged 4 commits into
apache:mainfrom
mapleFU:print-json-should-be-valid-json
Oct 31, 2024
Merged

mapleFU merged 4 commits into
apache:mainfrom
mapleFU:print-json-should-be-valid-json

Conversation

@mapleFU

@mapleFU mapleFU commented Oct 25, 2024 •

Copy link
Copy Markdown
Member

Rationale for this change

The printJson is not a valid json now. This is ok for human-read, but when I want to analysis it with json tools or ai, it will prevent from using it.

What changes are included in this PR?

Change the output to be a valid json.

Style:

previously, the \" trailing would be added in start of object, but this patch put it to end of object

Before:

stream << "\", \"number\":\""  << number;
stream << "\"...";

After:

stream << ", \"number\":\""  << number << "\"";

Are these changes tested?

Yes

Are there any user-facing changes?

Minor format change

@mapleFU
mapleFU requested a review from wgtmac as a code owner October 25, 2024 05:52
@mapleFU

mapleFU commented Oct 25, 2024

Copy link
Copy Markdown
Member Author

@pitrou @wgtmac this is a minor change for tool with testing. Would you mind take a look?

Comment thread cpp/src/parquet/reader_test.cc Outdated

// GH-44101: Test that JSON output is valid JSON
TEST_F(TestJSONWithLocalFile, ValidJsonOutput) {
auto checkJsonValid = [](std::string_view json_string) -> ::arrow::Status {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: check_valid_json?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@mapleFU

mapleFU commented Oct 25, 2024

Copy link
Copy Markdown
Member Author

https://github.com/apache/arrow/actions/runs/11514744258/job/32053979673?pr=44532

Emmm seems this is orc related, and unrelated to this patch? 🤔

@pitrou

pitrou commented Oct 25, 2024

Copy link
Copy Markdown
Member

@mapleFU The error message seems related, perhaps we need to make RapidJSON mandatory when Parquet tests are enabled?

D:/a/arrow/arrow/cpp/src/parquet/reader_test.cc(32): fatal error C1083: Cannot open include file: 'rapidjson/document.h': No such file or directory

@mapleFU

mapleFU commented Oct 25, 2024

Copy link
Copy Markdown
Member Author

Aha, my bad, will fix this

# correctly
target_link_libraries(parquet_testing PUBLIC ${ARROW_GTEST_GMOCK})
list(APPEND PARQUET_TEST_LINK_LIBS parquet_testing)
list(APPEND PARQUET_TEST_LINK_LIBS parquet_testing RapidJSON)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add rapidjson to PARQUET_TEST_LINK_LIBS, hope will not affect too much

@kou kou changed the title GH-44101: [C++][Parquet] Tools: Debug Print for Json should be valid Json GH-44101: [C++][Parquet] Tools: Debug Print for Json should be valid JSON Oct 28, 2024
@mapleFU

mapleFU commented Oct 31, 2024

Copy link
Copy Markdown
Member Author

Would merge this firstly

@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 0 benchmarking runs that have been run so far on merge-commit f5691d4.

None of the specified runs were found on the Conbench server.

The full Conbench report has more details.

@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit f5691d4.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants